﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/jquery.easyui.min.js"></script>
    <script src="../js/easyui-lang-zh_CN.js"></script>
    <link rel="stylesheet" href="../themes/icon.css">
    <link rel="stylesheet" href="../themes/default/easyui.css">
    <link rel="stylesheet" href="../css/wu.css">
    <script>
        var  selectIndex = -1;

        function hideTable(){
            $("#searchdiv").toggle();
        }

        
 $(function(){
            $("#productList").datagrid({
                fit:true, 
                url:'/kxmanage/osb2/company',
             /*    rownumbers:true, */
                pageNumber:1,
                pageSize:5,
                pageList:[5,10,20,30],
                pagination:true,
                columns:[[
                    /* {field:'ck',checkbox:true}, */
                    {field:'code',title:'客户代号',width:140},
                    {field:'name',title:'客户名称',width:200},
                    {field:'type',title:'客户类型',width:80,formatter:function(value,row,index){
                    	var str;
                    	if(row.type==1){
                    		str="客户"
                    	}else if(row.type==2){
                    		str="供应商"
                    	}else{
                    		str="客户/供应商"
                    	}
                    	return str;
                    	}}, 
                    {field:'linkman',title:'联系人员',width:60},
                    {field:'phone',title:'电话',width:120},
                    {field:'fax',title:'传真',width:120},
                    {field:'address',title:'地址',width:150}
                    
                   
                ]],
                toolbar:'#wu_toolbar',
                onClickRow:function(index,data){
                	$(this).datagrid('unselectRow',index);
                },
				onDblClickRow : function(index, row) {
					var name=row.name;
					var linkman=row.linkman;
					var phone=row.phone;
					var fax=row.fax;
					var address=row.address;
					var data=new Array();
					data[0]=name;
					data[1]=linkman;
					data[2]=phone;
					data[3]=fax;
					data[4]=address;
					parent.bindValue(data);		
					parent.closeSon();
					
				},
				onClickRow:function(index, row) {
					var name=row.name;
					var linkman=row.linkman;
					var phone=row.phone;
					var fax=row.fax;
					var address=row.address;
					var data=new Array();
					data[0]=name;
					data[1]=linkman;
					data[2]=phone;
					data[3]=fax;
					data[4]=address;
					parent.bindValue(data);
					parent.closeSon();
				}

            });
            
            
            $("#search_btn").click(function(){
	       	var form=$("#form1");
  		 	$("#productList").datagrid('load',serializeForm(form));
  		  })
        })
       
         //将表单序列化
			function serializeForm(form){
				var obj={};
			$.each(form.serializeArray(),function(index){
				  if(obj[this['name']]){
					obj[this['name']]=obj[this['name']]+','+this['value']
				 }else{
				   obj[this['name']]=this['value'];
				 }
			});
			return obj;
		} 
        
    </script>

</head>
<body>
<div id="wu_toolbar">
    <div class="wu_toolbar_button">
        <a  href="#" onclick="hideTable()" class="easyui-linkbutton" data-options="iconCls:'icon-search'" plain="true">查询</a>
    </div>
    <div id="searchdiv" style="display: block;width: 100%;">
        <form name="form1" id="form1" action="/kxmanage/osb2/show" method="post">
		<input name="page" value="1" type="hidden"/>
		<input name="rows" value="5" type="hidden"/>
            <table width="100%" border="0" cellspacing="0" style="background-color:#c9dfff;" >
                <tbody><tr>
                    <td width="70"><b>检索条件:</b></td>
                    <td width="70" align="right">客户代号:</td>
                    <td width="150" align="left"><input name="findcode" class="easyui-textbox" type="text" id="findcode" value="" maxlength="100"></td>
                    <td width="70" align="right">客户名称:</td>
                    <td width="150" align="left"><input name="findsupplierName" class="easyui-textbox" type="text" id="findsupplierName" value="" maxlength="100"></td>
                    <td width="70" align="right">单位类别:</td>
                    <td width="150" align="left">
						<select name="findtype" class="easyui-combobox" style="width:140px" panelHeight="80px">
							<option value="0">全选择</option>
							<option value="1">客户</option>
							<option value="3">客户/供应商</option>
						</select>
					</td>
                    <td width="72">
                        <a id="search_btn" href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'icon-search'">搜索</a>
                    </td>
                    <td width="72">
                        <a id="reset_btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-refresh'">重置</a>
                    </td>
                    <td width="0"></td>


                </tr>
                </tbody>
            </table>
            <input type="hidden" id="menuCode" value="100001001">
        </form>
    </div>
</div>
<div id="productList" class="easyui-datagrid">

</div>
</body>
</html>